package com.xjtu.mybatisplus.service.impl;

import com.xjtu.mybatisplus.common.JsonResponse;
import com.xjtu.mybatisplus.mapper.ArticleMapper;
import com.xjtu.mybatisplus.mapper.CommentMapper;
import com.xjtu.mybatisplus.mapper.FavoriteMapper;
import com.xjtu.mybatisplus.service.StaticService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StaticServiceImpl implements StaticService {

    @Autowired
    ArticleMapper articleMapper;

    @Autowired
    CommentMapper commentMapper;

    @Autowired
    FavoriteMapper favoriteMapper;
    @Override
    public JsonResponse getArticle() {
        Integer integer = articleMapper.selectCount(null);
        return JsonResponse.success(integer);
    }

    @Override
    public JsonResponse getComment() {
        Integer integer = commentMapper.selectCount(null);
        return JsonResponse.success(integer);
    }

    @Override
    public JsonResponse getFav() {
        Integer integer = favoriteMapper.selectCount(null);
        return JsonResponse.success(integer);
    }
}
